
using UnityEditor;
using UnityEngine;
using System.Collections;

public class CSOFDooAvaterPartsMenuItem : MonoBehaviour {




    [MenuItem("Doo/MakeAvatarParts")]
    static void MakeAvatarParts() 
    {
      /*  Debug.Log("Doing Something...");
        Debug.Log("Selected Transform is on " + Selection.activeTransform.gameObject.name + ".");*/

        Selection.activeTransform.gameObject.AddComponent<CSOFDooAvatarPartsMaker>();



        SkinnedMeshRenderer ThisRenderer = Selection.activeTransform.gameObject.GetComponent<SkinnedMeshRenderer>();


        string[] MyBones = new string[ThisRenderer.bones.Length];

        // As clips are using bones by their names, we find them that way.




        for (int i = 0; i < ThisRenderer.bones.Length; i++)
		{
			if ( ThisRenderer.bones[i] )
            	MyBones[i] = ThisRenderer.bones[i].name;
		}



        Selection.activeTransform.gameObject.GetComponent<CSOFDooAvatarPartsMaker>().SetupBoneName(MyBones);


    }



    /*
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
     * */
}
